package org.luxor.commons.redis.event;

import org.luxor.commons.core.utils.Jackson2Utils;
import org.luxor.commons.redis.annotation.RedisListener;
import org.luxor.commons.redis.component.RedisListenerReceiver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;


/**
 * 用户改变事件接收器
 *
 * @author Mr.yan @date 2019/10/12
 */
@Service
@RedisListener(channel = "UserChangeEvent")
public class UserChangeEventReceiver implements RedisListenerReceiver {
    private static final Logger log = LoggerFactory.getLogger(UserChangeEventReceiver.class);

    @Override
    public void onMessage(String message, String channel) {
        UserChangeEvent eventInfo = Jackson2Utils.toBean(message, UserChangeEvent.class);
        log.info("收到用户改变事件. [{}]", eventInfo);
    }
}
